﻿@model PagedList.IPagedList<CTM.Web.Models.View.Role.RoleViewModel>
@using PagedList.Mvc;
<link href="@Url.Content("~/Content/PagedList.css")" rel="stylesheet" type="text/css" />
@{
    ViewBag.Title = "Roles";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Roles</h2>
@*<p>
    @Html.ActionLink("Create New", "Create")
</p>*@
@using (Html.BeginForm("Index", "Role", FormMethod.Get))
{
    <p>
        Find by name: @Html.TextBox("SearchString", ViewBag.CurrentFilter as string)
        <input type="submit" value="Search" />
    </p>
}
<table class="table">
    <tr>
        <th>
            @Html.ActionLink("Role", "Index", new { sortOrder = ViewBag.NameSortParm, currentFilter = ViewBag.CurrentFilter })
        </th>
        <th></th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            @*<td>
                    @Html.ActionLink("Edit", "Edit", new { id = item.Name }) |
                    @Html.ActionLink("Details", "Details", new { id = item.Name }) |
                    @Html.ActionLink("Delete", "Delete", new { id = item.Name })
                </td>*@
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.Name })
            </td>
        </tr>
    }
</table>
<br />
Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
@Html.PagedListPager(Model, page => Url.Action("Index", new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }))